package net.airtheva.uniqueTask2.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import net.airtheva.uniqueTask2.R;
import net.airtheva.uniqueTask2.R.id;
import net.airtheva.uniqueTask2.R.layout;
import net.airtheva.uniqueTask2.R.styleable;

public class OpenDialogBox extends LinearLayout {

	String mText = "文本";
	TextView mTextView = null;
	
	public OpenDialogBox(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
		TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.OpenDialogBox);
		mText = attributes.getString(R.styleable.OpenDialogBox_text);
		attributes.recycle();
	}

	@Override
	protected void onFinishInflate() {
		// TODO Auto-generated method stub
		super.onFinishInflate();
		LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = inflater.inflate(R.layout.open_dialog_box, null);
        
        mTextView = (TextView) view.findViewById(R.id.open_dialog_box_text);
        mTextView.setText(mText);

        addView(view);
	}
	
}
